home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
dev
/
e
/
amigae21b.lha
/
Amiga_E_v2.1b
/
Sources
/
Utilities
/
SuperVisor.e
< prev
next >
Wrap
Text File
|
1992-09-02
|
5KB
|
165 lines
/* A system monitor written in E. It does't perform any very special
functions, can be a neat addition to Xoper or ARTM, however.
BUG: doesn't display processes that run on the process-structure of
another process */
ENUM TASKS,LIBRARIES,DEVICES,PORTS,WINDOWS
CONST GFXOFFSET=40, BUFSIZE=GADGETSIZE*5
/* we search for our os-variables the clean way, so we need a lot
of modules ... */
MODULE 'intuition/intuition', 'exec/execbase', 'exec/lists',
'exec/libraries', 'exec/nodes', 'exec/tasks', 'exec/ports',
'intuition/intuitionbase', 'intuition/screens'
DEF glist[BUFSIZE]:ARRAY,window,gad=TASKS,
exec:PTR TO execbase,list:PTR TO lh
PROC main()
DEF next,class,object:PTR TO gadget
next:=Gadget(glist,NIL,TASKS,0,5,2,80,'Tasks')
next:=Gadget(next,glist,LIBRARIES,0,90,2,80,'Libraries')
next:=Gadget(next,glist,DEVICES,0,175,2,80,'Devices')
next:=Gadget(next,glist,PORTS,0,260,2,80,'Ports')
next:=Gadget(next,glist,WINDOWS,0,345,2,80,'Windows')
window:=OpenW(0,11,640,245,$242,$140F,'Amiga SuperVisor',0,1,glist)
IF window<>NIL
exec:=execbase
displaylist(gad)
WHILE (class:=WaitIMessage(window))<>IDCMP_CLOSEWINDOW
IF class=IDCMP_GADGETUP
object:=MsgIaddr()
gad:=object.userdata
ENDIF
displaylist(gad) /* for GADGETUP and RESIZE */
ENDWHILE
CloseW(window)
ENDIF
ENDPROC
PROC displaylist(gad)
DEF funcs:PTR TO LONG
funcs:=[`displaytasks(),`displaylibraries(),`displaydevices(),
`displayports(),`displaywindows()]
Eval(funcs[gad])
ENDPROC
PROC initdisplay(string)
Move(stdrast,0,GFXOFFSET-18)
ClearScreen(stdrast)
Colour(1,0)
TextF(5,GFXOFFSET-12,string)
Colour(2,0)
ENDPROC
PROC displaytasks()
DEF tlist:PTR TO tc,tlist2:PTR TO tc,off=GFXOFFSET,node:PTR TO ln
initdisplay('Taskname Pri Sig Stack')
Forbid()
list:=exec.taskwait
tlist2:=list.head
list:=exec.taskready
tlist:=list.head
WHILE tlist
node:=tlist
IF node.succ
TextF(5,off,'\l\s[20] \r\d[5] $\z\h[8] \r\d[6]',
node.name,node.pri,tlist.sigwait,tlist.spupper-tlist.splower)
off:=off+8
ENDIF
tlist:=node.succ
IF (tlist=NIL) AND (tlist2<>NIL)
tlist:=tlist2
tlist2:=NIL
IF off<>GFXOFFSET THEN off:=off+4
ENDIF
ENDWHILE
Permit()
ENDPROC
PROC displaylibraries()
DEF llist:PTR TO lib,off=GFXOFFSET,node:PTR TO ln
initdisplay('Libraryname Pri Version OpenCnt')
Forbid()
list:=exec.liblist
llist:=list.head
WHILE llist
node:=llist
IF node.succ
TextF(5,off,'\l\s[25] \r\d[5] \d[3].\l\d[4] \d[3]',
node.name,node.pri,llist.version,llist.revision,llist.opencnt)
off:=off+8
ENDIF
llist:=node.succ
ENDWHILE
Permit()
ENDPROC
PROC displaydevices()
DEF dlist:PTR TO lib,off=GFXOFFSET,node:PTR TO ln
initdisplay('Devicename Pri Version OpenCnt')
Forbid()
list:=exec.devicelist
dlist:=list.head
WHILE dlist
node:=dlist
IF node.succ
TextF(5,off,'\l\s[25] \r\d[5] \d[3].\l\d[4] \d[3]',
node.name,node.pri,dlist.version,dlist.revision,dlist.opencnt)
off:=off+8
ENDIF
dlist:=node.succ
ENDWHILE
Permit()
ENDPROC
PROC displayports()
DEF plist:PTR TO mp,taskname,portname,off=GFXOFFSET,node:PTR TO ln,t:PTR TO ln
initdisplay('Portname Pri Bit# Task')
Forbid()
list:=exec.portlist
plist:=list.head
WHILE plist
node:=plist
IF node.succ
portname:=node.name
IF (portname<>NIL) AND (portname[]<>0)
t:=plist.sigtask
taskname:=t.name
IF taskname=NIL THEN taskname:='-'
TextF(5,off,'\l\s[25] \d[5] \d[5] \s[20]',
node.name,node.pri,plist.sigbit,taskname)
off:=off+8
ENDIF
ENDIF
plist:=node.succ
ENDWHILE
Permit()
ENDPROC
PROC displaywindows()
DEF slist:PTR TO screen,wlist:PTR TO window,
off=GFXOFFSET,intui:PTR TO intuitionbase
Forbid()
intui:=intuitionbase
initdisplay('Windowname Width Height IDCMP FLAGS')
slist:=intui.firstscreen
WHILE slist
Colour(3,0)
TextF(5,off,'\l\s[25] \d[5] \d[3]',
slist.title,slist.width,slist.height)
Colour(2,0)
off:=off+8
wlist:=slist.firstwindow
WHILE wlist
TextF(5,off,'\l\s[25] \d[5] \d[3] $\z\r\h[8] $\z\r\h[8]',
wlist.title,wlist.width,wlist.height,wlist.idcmpflags,wlist.flags)
wlist:=wlist.nextwindow
off:=off+8
ENDWHILE
slist:=slist.nextscreen
ENDWHILE
Permit()
ENDPROC